package com.wwt.springboot_vue.mapper;


import com.wwt.springboot_vue.bean.Notice;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NoticeMapper {

    @Select("SELECT * from notice")
    List<Notice>  findAll();

    @Insert("INSERT into notice(notice_title, notice_article, user_nichen) VALUE (#{notice_title }, " +
            "#{ notice_article}, #{user_nichen });")
    int insert(Notice notice);


    @Update("update notice set notice_title = #{notice_title}, notice_article = #{notice_article}," +
            "user_nichen = #{user_nichen} where notice_id = #{notice_id} " )
    int update(Notice notice);


    @Delete("delete from notice where notice_id =#{notice_id}")
    Integer deleteById(@Param("notice_id") Integer notice_id);


    @Select("select * from notice where notice_title like concat('%',#{notice_title},'%') limit #{pageNum}, #{pageSize}")
    List<Notice> selectPage(Integer pageNum, Integer pageSize, String notice_title);

    @Select("select count(*) from notice where notice_title like concat('%',#{notice_title},'%') ")
    Integer selectTotal(String notice_title);


    @Select("SELECT * from notice")
    List<Notice> list();
}
